STEP 6: If the loop begins a new iteration, the level increases. Let's make it so that we see this on the stage!

A while loop can cause an infinite loop error if the condition of the loop never becomes False.

  • From , drag Add Value inside the while loop above the .wait(). Change my_var to level.
  • Drag Update Display onto the next line above .wait() and change the variable my_var to level.
  • Click Run to see the level count up infinitely! Make sure to click Stop before submitting!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)